/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author fumio
 */
public class Publico {

    public static String NoMask(String texto) {
        if (texto != null) {
            texto = texto.replace("-", "").replace(".", "").replace("_", "").replace("(", "").replace(")", "").replace("/", "");
            return texto;
        }
        return texto;
    }

    public static Date ConverteDate(String data) throws Exception {
        if (data == null || data.equals("")) {
            return null;
        }
        Date date = null;
        try {
            DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            date = (java.util.Date) formatter.parse(data);
        } catch (ParseException e) {
            throw e;
        }
        return date;
    }
 public static String CalendarToString(Calendar calendar) {
        SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
        return df.format(calendar.getTime());
    }


}
